// An highlighted block
#define STOP      '1'

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); //RX=2,TX=3
int led = 6;

void setup() {
  Serial.begin(9600);
  mySerial.begin(9600);
  pinMode(led,OUTPUT);
}

void loop() {
  while(1)
    {
        mySerial.listen();
        if (mySerial.available() > 0 ) 
        {
          char control = mySerial.read();
          Serial.write(control);
          motorRun(control);
        }
    }
}

void motorRun(char control)
{
  switch(control)
  {
    case STOP:
      digitalWrite(led, HIGH);
      delay(1000);
      digitalWrite(led, LOW);
      break;
  }
}
